import {
  defineStore
} from 'pinia';

import {
  ref
} from 'vue';


export const patientInfoStore = defineStore('patient', () => {
  // 初始化问诊信息
  const illnessValue = ref({
    illnessDesc: '',
    consultFlag: '',
    illnessTime: '',
    pictures: []
  })

  // 问诊信息
  const illnessInfo = ref({
    ...illnessValue.value
  })

  // 网页参数
  const illnessDescInfo = ref({
    "type": "",
    "illnessType": "",
    "depId": ""
  })

  // 患者id
  const patidentId = ref('')

  return {
    illnessValue,
    illnessInfo,
    illnessDescInfo,
    patidentId
  }
}, {
  persist: {
    paths: ['illnessValue', 'illnessInfo', 'illnessDescInfo', 'patidentId'],
    // #ifdef MP-WEIXIN
    storage: {
      setItem: (key, value) => wx.setStorageSync(key, value),
      getItem: (key) => wx.getStorageSync(key),
      removeItem: (key) => wx.removeStorageSync(key),
    }
    // #endif
  }
})